<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 14-5-16
 * Time: 上午11:17
 */
namespace Common\Behavior;
use Think\Behavior;
use Think\Controller;

class CheckBehavior extends Behavior{
	//行为执行入口
	public function run(&$param){
		Vendor('Discuz.Client');
		$uc = new \Client();
		if(!$uc->check_login()){
			if(!in_array(ACTION_NAME, array('index', 'Index', 'login', 'register')))
				redirect(U('Index/index'), 0, UCMSG_NOT_LOGIN);
		}else{
			if(ACTION_NAME == 'register')
				redirect(U('Index/index'), 0, UCMSG_REGISTER_SUCCESS);
		}
	}
}